#include <pthread.h>
#include "my_thread.h"
#include "my_log.h"
#include "dbg_trace.h"


/************************************************************************
						函数区
*************************************************************************/
pthread_t ntid;
Thread_Status_T g_ThreadRunInfo = 
{
	0, 0, 0, 0
};
/************************************************************************/


/************************************************************************
						函数区
*************************************************************************/
static void *thr_fn(void *arg);
/************************************************************************/


//创建线程接口
MY_S32 CreateMyThread(void)
{	
	MY_S32 s32Err;
	
	s32Err = pthread_create(&ntid, NULL, thr_fn, NULL);
	if(0 != s32Err)
	{
		DBG_TRACE_ERROR("New Thread Create Fail!!")	
	}

	return s32Err;
}


//打印线程信息
void PrintThreadInfo(const MY_CHAR *s)
{
	pid_t pid;
	pthread_t tid;

	pid = getpid();
	tid = pthread_self();

	DBG_TRACE_DEBUG("%s pid %lu tid %lu (0x%lx)", s, (unsigned long)pid, (unsigned long)tid, (unsigned long)tid);
}





//线程执行函数
void *thr_fn(void *arg)
{
	PrintThreadInfo("New Thread: ");

	MY_U8 u8OffSet = 0;
	u8OffSet = LOS_OFF_SET_OF(Thread_Status_T, u16ConnectCnt);
	DBG_TRACE_DEBUG("u8OffSet = %d", u8OffSet);
	
	while(1)
	{
		sleep(1);		
	}

	return NULL;
}

	

